package Homework;

public class RandomTest {

	public static void main(String[] args) {

		int i;
		int number;
		int count=0;
		int a[] = new int[20];
		for(i=0;;i++)
		{
			number = (int)(Math.random()*30)+1;
			if(!exit(a,number))
			{
				a[count++] = number;
			}
			if(count==20)
			{
				break;
			}
		}
		for(i=0;i<a.length ;i++)
		{
			System.out.print(a[i] +"  ");
		}

	}
	
	static boolean exit(int a[],int number)
	{
		boolean flag =false;
		for(int i=0;i<a.length ;i++)
		{
			if(a[i] == number)
			{
				flag = true;
				break;
			}
		}
		return flag;
	}

}
